#ifndef TUNNEL_STRUCKTS_H
#define TUNNEL_STRUCKTS_H

#include <QtCore/QString>

// +----Packagetyps
// +--------Command Category
// +------------Command
#define TUNNEL_PACKAGETYP_SYSTEM                        0 // System
#define     TUNNEL_COMMANDCATEGORY_COMM                     0 // Communication
#define         TUNNEL_COMMAND_COMM_AUTH                        0 // Authentification

#define     TUNNEL_COMMANDCATEGORY_FRIENDS                  1 // Friends
#define         TUNNEL_COMMAND_FRIENDS_UPDATEFRIENDLIST         0 // Update friendlist
#define         TUNNEL_COMMAND_FRIENDS_ADDFRIEND                1 // Add friend
#define         TUNNEL_COMMAND_FRIENDS_GETFRIENDREQUESTS        2 // Get friend requests
#define         TUNNEL_COMMAND_FRIENDS_ACCEPTFRIENDINVENTATION  3 // Accept friendship inventation
#define         TUNNEL_COMMAND_FRIENDS_FRIENDGOESONLINE         4 // Friend turned status from offline to online.
#define         TUNNEL_COMMAND_FRIENDS_FRIENDGOESOFFLINE        5 // Friend turned status from online to offline.
#define         TUNNEL_COMMAND_FRIENDS_FRIENDCHANGENICKNAME     6 // Friend changed his nickname.

#define     TUNNEL_COMMANDCATEGORY_INFORMATION              2 // Information
#define         TUNNEL_COMMAND_INFORMATION_ERRORMESSAGE         0 // Error message
#define         TUNNEL_COMMAND_INFORMATION_INFOMESSAGE          1 // Info message

#define     TUNNEL_COMMANDCATEGORY_CLIENT                   3 // Client
#define         TUNNEL_COMMAND_CLIENT_CHANGENICKNAME            0 // Change Nickname



#define TUNNEL_PACKAGETYP_MESSAGE                       1 // Message


// Packagetyps
//
// Global Package
// * Packagetyp
//
// Message Package
// * Packagetyp = Message
// * To (recepient)
// * Message
// * From (sender)
//
// System Package
// * Packagetyp = System
// * Command Category
// * Command
// * Command Arguments
struct Package
{
    quint16 typ;                // Global Package
    QString message;            // Message Package
    QString from;               // Message Package
    QString to;                 // Message Package
    quint16 commandCategory;    // System Package
    quint16 command;            // System Package
    QString arguments;          // System Package
};

inline void setupSystemPackage(Package *package, quint16 category, quint16 command, QString arguments = "")
{
    package->typ             = TUNNEL_PACKAGETYP_SYSTEM;
    package->commandCategory = category;
    package->command         = command;
    package->arguments       = arguments;
}

inline void setupMessagePackage(Package *package, const QString &from, const QString &message, const QString &to = "")
{
    package->typ     = TUNNEL_PACKAGETYP_MESSAGE;
    package->from    = from;
    package->to      = to;
    package->message = message;
}

#endif // TUNNEL_STRUCKTS_H
